home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / samples / delphi / miniplay.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1997-01-17  |  1.3 KB  |  56 lines

  1. {*      miniplay.pas
  2.  *
  3.  * A minimal Delphi console module player example
  4.  *
  5.  * Compile to a console application and link with midasdll unit
  6.  *
  7.  * Copyright 1996,1997 Housemarque Inc
  8.  *
  9.  * This file is part of the MIDAS Sound System, and may only be
  10.  * used, modified and distributed under the terms of the MIDAS
  11.  * Sound System license, LICENSE.TXT. By continuing to use,
  12.  * modify or distribute this file you indicate that you have
  13.  * read the license and understand and accept it fully.
  14. *}
  15.  
  16. uses
  17.     midasdll, sysutils;
  18.  
  19.  
  20. procedure MIDASerror;
  21. begin
  22.     WriteLn('MIDAS error: ', MIDASgetErrorMessage(MIDASgetLastError));
  23.     MIDASclose;
  24.     halt;
  25. end;
  26.  
  27.  
  28. var
  29.     module : MIDASmodule;
  30.  
  31. BEGIN
  32.     MIDASstartup;
  33.     if not MIDASinit then
  34.         MIDASerror;
  35.     if not MIDASstartBackgroundPlay(0) then
  36.         MIDASerror;
  37.  
  38.     module := MIDASloadModule('..\data\templsun.xm');
  39.     if module = NIL then
  40.         MIDASerror;
  41.  
  42.     if not MIDASplayModule(module, 0) then
  43.         MIDASerror;
  44.  
  45.     WriteLn('Playing - press enter');
  46.     ReadLn;
  47.  
  48.     if not MIDASstopModule(module) then
  49.         MIDASerror;
  50.     if not MIDASfreeModule(module) then
  51.         MIDASerror;
  52.     if not MIDASstopBackgroundPlay then
  53.         MIDASerror;
  54.     if not MIDASclose then
  55.         MIDASerror;
  56. END.